
<html><HEAD>
<LINK REL=STYLESHEET HREF="default.css" TYPE="text/css">
<TITLE>
Generating Web service proxy objects</TITLE>
</HEAD>
<BODY>

<!-- Header -->
<p class="ancestor" align="right"><A HREF="apptechp199.htm">Previous</A>&nbsp;&nbsp;<A HREF="apptechp201.htm" >Next</A>
<!-- End Header -->
<A NAME="BABFADAI"></A><h1>Generating Web service proxy objects</h1>
<A NAME="TI5814"></A><h4>Creating a Web service proxy object</h4>
<A NAME="TI5815"></A><p>To create
a new Web service proxy, select the Web Service Proxy Wizard icon from
the Projects page in the New dialog box. The Web Service Proxy Wizard helps
you create the proxy so you can use the Web service in PowerScript.
If you select the EasySoap Web service engine, one proxy is created
for each port.</p>
<A NAME="TI5816"></A><p>In the wizard you specify:<A NAME="TI5817"></A>
<ul>
<li class=fi>Which Web
service engine you want to use</li>
<li class=ds>Which WSDL file you want to access</li>
<li class=ds>Which service within the WSDL file you want to select</li>
<li class=ds>Which port or ports you want to use (EasySoap engine
only)</li>
<li class=ds>What prefix you want to append to a port name (EasySoap)
and include in the proxy name (EasySoap and .NET engines)</li>
<li class=ds>Which PowerBuilder library you want to deploy the
proxy to
</li>
</ul>
</p>
<A NAME="TI5818"></A><p>You can also select the Web Service Proxy icon from the Projects
page in the New dialog box. The Web Service Proxy icon opens the
Project painter for Web services so that you can create a project,
specify options, and build the proxy library. The new project lists
the Web service (and, for the EasySoap engine, the ports for which
proxies will be generated) and specifies the name of the output
library that will contain the generated proxy objects.</p>
<A NAME="TI5819"></A><p>Whether you create the Web service project through the wizard
or in the painter, the final step is to build the proxy objects
by clicking the Build icon on the painter bar or selecting Design&gt;Deploy
project from the menu bar. </p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>Circular references</span> <A NAME="TI5820"></A>Generation of a Web service proxy from a WSDL file that contains
a circular reference is not supported in PowerBuilder. An example
of such a "circular reference" is a structure
that includes itself as a child class member.</p>
<A NAME="TI5821"></A><h4>Generated proxies</h4>
<A NAME="TI5822"></A><p>The generated proxies display in the System Tree. You can
expand the proxy nodes to display the signatures of the methods.</p>
<br><img src="images/genprox.gif">
<A NAME="TI5823"></A><h4>Aliases for XML methods</h4>
<A NAME="TI5824"></A><p>PowerBuilder is not case sensitive,
whereas XML, SOAP, C#, and .NET are. To ensure that PowerScript
code can call XML methods correctly, each method in the proxy uses
an alias. The string that follows <FONT FACE="Courier New">alias for</FONT> contains
the name and the signature of the corresponding XML or SOAP method
in case-sensitive mode. </p>
<A NAME="TI5825"></A><p>For example:</p>
<A NAME="TI5826"></A><p><p><PRE> function real getquote(string ticker) alias for getQuote(xsd:string symbol)#<br>return xsd:float StockPrice@urn:xmethods-delayed-quotes@SoapAction</PRE></p>
<A NAME="TI5827"></A><h4>PowerBuilder system types cannot be used as variable
names in proxies</h4>
<A NAME="TI5828"></A><p>In PowerBuilder 10.5 and later versions, system types cannot
be used as variable names in Web service proxies. If a PowerBuilder
system type is used as a variable name, the Web Service Proxy wizard
renames the variable by applying the prefix <b>ws_</b>.
If you are migrating Web service applications from PowerBuilder
10.2 or earlier and regenerating the Web service proxies in PowerBuilder
10.5 or later, your code may need to be modified to reflect the change
in variable names.</p>
<A NAME="TI5829"></A><p>PowerBuilder system types include not only the objects and
controls listed on the System tab page in the PowerBuilder Browser,
but also the enumerated types listed on the Enumerated page in the
Browser, such as band, button, encoding, location, and weekday.
For example, if you build a Web service from a PowerBuilder custom
class user object, and one of its functions has a <b>string</b> argument
named <i>location</i>, in the proxy generated for
that Web service, the argument is changed to <b>string</b> <i>ws_location</i>. </p>
<A NAME="TI5830"></A><h4>Web services across time zones</h4>
<A NAME="TI5831"></A><p>When an application consumes a Web service that uses the date,
time, or datetime datatypes, it is possible that the service implementation
processes and returns different data for application users who access
the service from different time zones. This is typically the result
of design considerations of the Web service and not the result of
precision differences or translation errors between the Web service
and the application that calls it. </p>
<A NAME="TI5832"></A><h4>Datatype mappings for EasySoap Web service engine</h4>
<A NAME="TI5833"></A><p>The Web service proxy
generator maps datatypes between XML and PowerBuilder if you use
the EasySoap Web engine, and between XML, C#, .NET, and
PowerBuilder if you use the .NET Web service engine. All XML data
types are based on schemas from the <A HREF="http://www.w3.org/1999/XMLSchema">World Wide Web Consortium Web site</A>
 <A HREF="http://www.w3.org/2001/XMLSchema">and</A>
.</p>
<A NAME="TI5834"></A><p><A HREF="apptechp200.htm#CHDDJDCE">Table 30-2</A> shows
the datatype mappings between XML and PowerScript. If you use the
.NET Web service engine, datatypes are converted to C#,
then to .NET datatypes. (<A HREF="apptechp200.htm#CHDGABIJ">Table 30-3</A> and <A HREF="apptechp200.htm#CHDEICDD">Table 30-4</A> show datatype mappings used with the
.NET Web service engine.)</p>
<A NAME="CHDDJDCE"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 30-2: Datatype mappings between XML
and PowerBuilder</caption>
<tr><th  rowspan="1"  ><A NAME="TI5835"></A>XML Type</th>
<th  rowspan="1"  ><A NAME="TI5836"></A>PowerScript Type</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5837"></A>boolean</td>
<td  rowspan="1"  ><A NAME="TI5838"></A>boolean</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5839"></A>byte (-128 to 127) or short</td>
<td  rowspan="1"  ><A NAME="TI5840"></A>int</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5841"></A>unsignedByte (0 to 255) or unsignedShort</td>
<td  rowspan="1"  ><A NAME="TI5842"></A>uint</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5843"></A>int</td>
<td  rowspan="1"  ><A NAME="TI5844"></A>long</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5845"></A>unsignedInt</td>
<td  rowspan="1"  ><A NAME="TI5846"></A>ulong</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5847"></A>long (-9223372036854775808 to 9223372036854775807), unsignedLong
(0 to 9223372036854775807), integer (-9223372036854775808
to 9223372036854775807), nonNegativeInteger (0 to 9223372036854775807), <br>negativeInteger
(-1 to -9223372036854775808),<br>nonPositiveInteger (0 to
-9223372036854775808), or<br>positiveInteger (1 to 9223372036854775807)</td>
<td  rowspan="1"  ><A NAME="TI5848"></A>longlong</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5849"></A>decimal (-999999999999999999 to 999999999999999999)</td>
<td  rowspan="1"  ><A NAME="TI5850"></A>decimal</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5851"></A>float</td>
<td  rowspan="1"  ><A NAME="TI5852"></A>real</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5853"></A>double</td>
<td  rowspan="1"  ><A NAME="TI5854"></A>double</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5855"></A>gYear, gYearMonth, gMonthDay, gDay, anyURI,
QName, <br>NOTATION, string, normalizedSting, token, or datatypes
derived from token<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <span class=shaded>About normalizedString, token, and derived datatypes</span> <A NAME="TI5856"></A>A normalized string does not contain carriage return, line
feed, or tab characters. A token is similar to similar to a normalizedString, but
does not contain leading or trailing spaces or an internal sequence
of two or more spaces. Datatypes that derive from token include
language, Name, NCName, NMTOKEN, NMTOKENS, ID, IDREF, IDREFS, ENTITY,
ENTITIES.</p>
</td>
<td  rowspan="1"  ><A NAME="TI5857"></A>string</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5858"></A>date</td>
<td  rowspan="1"  ><A NAME="TI5859"></A>date</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5860"></A>time</td>
<td  rowspan="1"  ><A NAME="TI5861"></A>time</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5862"></A>dateTime</td>
<td  rowspan="1"  ><A NAME="TI5863"></A>datetime</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5864"></A>base64, base64Binary, or hexBinary</td>
<td  rowspan="1"  ><A NAME="TI5865"></A>blob</td>
</tr>
</table>
<A NAME="TI5866"></A><h4>Datatype mappings for .NET Web service engine</h4>
<A NAME="TI5867"></A><p>When you use the .NET Web Service engine, PowerBuilder converts
the XML from WSDL files to C# code and compiles it in a
.NET assembly. </p>
<p><img src="images/note.gif" width=17 height=17 border=0 align="bottom" alt="Note"> <A NAME="TI5868"></A>Web services that use unmapped Microsoft .NET specific
datatypes, such as DataSet or System.Xml.XmlElement, are not supported.</p>
<A NAME="TI5869"></A><p><A HREF="apptechp200.htm#CHDGABIJ">Table 30-3</A> displays
datatype mappings for these conversions.</p>
<A NAME="CHDGABIJ"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 30-3: Datatype mappings for the .NET
Web service engine</caption>
<tr><th  rowspan="1"  ><A NAME="TI5870"></A>XML type</th>
<th  rowspan="1"  ><A NAME="TI5871"></A>C# type</th>
<th  rowspan="1"  ><A NAME="TI5872"></A>.NET type</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5873"></A>int</td>
<td  rowspan="1"  ><A NAME="TI5874"></A>int</td>
<td  rowspan="1"  ><A NAME="TI5875"></A>System.Int32</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5876"></A>unsignedInt</td>
<td  rowspan="1"  ><A NAME="TI5877"></A>uint</td>
<td  rowspan="1"  ><A NAME="TI5878"></A>System.UInt32</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5879"></A>boolean</td>
<td  rowspan="1"  ><A NAME="TI5880"></A>bool</td>
<td  rowspan="1"  ><A NAME="TI5881"></A>System.Boolean</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5882"></A>unsignedByte</td>
<td  rowspan="1"  ><A NAME="TI5883"></A>Byte</td>
<td  rowspan="1"  ><A NAME="TI5884"></A>System.Byte</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5885"></A>short</td>
<td  rowspan="1"  ><A NAME="TI5886"></A>short</td>
<td  rowspan="1"  ><A NAME="TI5887"></A>System.Int16</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5888"></A>unsignedShort</td>
<td  rowspan="1"  ><A NAME="TI5889"></A>ushort</td>
<td  rowspan="1"  ><A NAME="TI5890"></A>System.UInt16</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5891"></A>long</td>
<td  rowspan="1"  ><A NAME="TI5892"></A>long</td>
<td  rowspan="1"  ><A NAME="TI5893"></A>System.Int64</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5894"></A>unsignedLong</td>
<td  rowspan="1"  ><A NAME="TI5895"></A>ulong</td>
<td  rowspan="1"  ><A NAME="TI5896"></A>System.UInt64</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5897"></A>Decimal</td>
<td  rowspan="1"  ><A NAME="TI5898"></A>Decimal</td>
<td  rowspan="1"  ><A NAME="TI5899"></A>System.Decimal</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5900"></A>Float</td>
<td  rowspan="1"  ><A NAME="TI5901"></A>Float</td>
<td  rowspan="1"  ><A NAME="TI5902"></A>System.Float</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5903"></A>Double</td>
<td  rowspan="1"  ><A NAME="TI5904"></A>Double</td>
<td  rowspan="1"  ><A NAME="TI5905"></A>System.Double</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5906"></A>Datetime, Date, and Time</td>
<td  rowspan="1"  ><A NAME="TI5907"></A>System.DateTime</td>
<td  rowspan="1"  ><A NAME="TI5908"></A>System.DateTime</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5909"></A>hexBinary and hex64Binary</td>
<td  rowspan="1"  ><A NAME="TI5910"></A>Byte [ ]</td>
<td  rowspan="1"  ><A NAME="TI5911"></A>System.Byte [ ]</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5912"></A>nonNegativeInteger, negativeInteger, nonPositiveInteger, positiveInteger,
gYear, gMonth, gMonthDay, gDay, duration, anyURI, QName, NOTATION, normalizedString,
token, language, NMTOKEN, NMTOKENS, Name, NCName,ID, IDREF, IDREFS, ENTITY,
ENTITIES, and String</td>
<td  rowspan="1"  ><A NAME="TI5913"></A>String</td>
<td  rowspan="1"  ><A NAME="TI5914"></A>System.String</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5915"></A>AnyType</td>
<td  rowspan="1"  ><A NAME="TI5916"></A>Object</td>
<td  rowspan="1"  ><A NAME="TI5917"></A>System.Object</td>
</tr>
</table>
<A NAME="TI5918"></A><p><A HREF="apptechp200.htm#CHDEICDD">Table 30-4</A> displays
the datatype mapping between C# datatypes and PowerBuilder.</p>
<A NAME="CHDEICDD"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 30-4: Datatype mappings between C# and
PowerBuilder</caption>
<tr><th  rowspan="1"  ><A NAME="TI5919"></A>C# type</th>
<th  rowspan="1"  ><A NAME="TI5920"></A>PowerScript type</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5921"></A>byte</td>
<td  rowspan="1"  ><A NAME="TI5922"></A>byte</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5923"></A>sbyte</td>
<td  rowspan="1"  ><A NAME="TI5924"></A>int</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5925"></A>short</td>
<td  rowspan="1"  ><A NAME="TI5926"></A>int</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5927"></A>int</td>
<td  rowspan="1"  ><A NAME="TI5928"></A>long</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5929"></A>long</td>
<td  rowspan="1"  ><A NAME="TI5930"></A>longlong</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5931"></A>ushort</td>
<td  rowspan="1"  ><A NAME="TI5932"></A>uint</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5933"></A>uint</td>
<td  rowspan="1"  ><A NAME="TI5934"></A>ulong</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5935"></A>ulong</td>
<td  rowspan="1"  ><A NAME="TI5936"></A>longlong</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5937"></A>float</td>
<td  rowspan="1"  ><A NAME="TI5938"></A>real</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5939"></A>double</td>
<td  rowspan="1"  ><A NAME="TI5940"></A>double</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5941"></A>object</td>
<td  rowspan="1"  ><A NAME="TI5942"></A>any</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5943"></A>char</td>
<td  rowspan="1"  ><A NAME="TI5944"></A>uint</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5945"></A>string</td>
<td  rowspan="1"  ><A NAME="TI5946"></A>string</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5947"></A>decimal</td>
<td  rowspan="1"  ><A NAME="TI5948"></A>decimal</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5949"></A>bool</td>
<td  rowspan="1"  ><A NAME="TI5950"></A>boolean</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI5951"></A>System.DateTime</td>
<td  rowspan="1"  ><A NAME="TI5952"></A>datetime</td>
</tr>
</table>
<A NAME="TI5953"></A><h4>Arrays of arrays</h4>
<A NAME="TI5954"></A><p>Unlike XML, PowerBuilder
can support only unbounded one-dimensional arrays. If an array in
a WSDL file is bounded and one-dimensional, PowerBuilder automatically
converts it to an unbounded array. If an array in a WSDL file is
multidimensional, the return type is invalid and cannot be used. </p>
<A NAME="TI5955"></A><p>In function prototypes, PowerBuilder displays an array type
as a PowerBuilder <b>any</b> type. You must declare
an array of the appropriate type to hold the return value.</p>

